<?php

/**
 * EvTicker class
 *
 * @author Julot <andy.julot@gmail.com>
 * @since Thursday, June 30, 2011. 03:05 PM
 */
class EvTicker extends CComponent {

	protected static function register() {
		$cs = Yii::app()->clientScript;
		$cs->registerCoreScript('jquery');
		$path = Yii::app()->extensionPath . '/EvTicker/';
		$asset = Yii::app()->getAssetManager()->publish($path);
		$cs->registerScriptFile($asset . '/jquery.vticker.1.4.js');
	}

	public static function add($selector="#vTicker", $options=array()) {
		self::register();
		$opts = CJavaScript::encode($options);
		$script = '$("' . $selector . '").vTicker(' . $opts .');';
		$cs = Yii::app()->clientScript;
		$cs->registerScript(__CLASS__, $script, CClientScript::POS_READY);
	}

}
